---
layout: "default"
title: "contains"
description: "Swift documentation for 'contains': Return true iff x is in seq."
keywords: "contains,func,swift,documentation"
root: "/v1.2"
---

<div class="declaration" id="func-contains-s_-sequencetype-where-s-generator-element_-equatable_-s-x_-s-generator-element">
<a class="toggle-link" data-toggle="collapse" href="#comment-func-contains-s_-sequencetype-where-s-generator-element_-equatable_-s-x_-s-generator-element">func <wbr>contains&lt;S :<wbr> SequenceType where S.Generator.Element : Equatable&gt;(<wbr>_:<wbr> S, x: S.Generator.Element)</a>
        
<div class="comment collapse" id="comment-func-contains-s_-sequencetype-where-s-generator-element_-equatable_-s-x_-s-generator-element"><div class="p">
    <p>Return <code>true</code> iff <code>x</code> is in <code>seq</code>.</p>

    <h4>Declaration</h4>    
    <code class="language-swift">func contains&lt;S : SequenceType where S.Generator.Element : Equatable&gt;(seq: S, x: S.Generator.Element) -&gt; Bool</code>
    
    
</div></div>
</div>
<div class="declaration" id="func-contains-s_-sequencetype-l_-booleantype_-s-predicate_-noescape-s-generator-element-l">
<a class="toggle-link" data-toggle="collapse" href="#comment-func-contains-s_-sequencetype-l_-booleantype_-s-predicate_-noescape-s-generator-element-l">func <wbr>contains&lt;S :<wbr> SequenceType, L : BooleanType&gt;(<wbr>_:<wbr> S, predicate: @noescape (S.Generator.Element) -&gt; L)</a>
        
<div class="comment collapse" id="comment-func-contains-s_-sequencetype-l_-booleantype_-s-predicate_-noescape-s-generator-element-l"><div class="p">
    <p>Return <code>true</code> iff an element in <code>seq</code> satisfies <code>predicate</code>.</p>

    <h4>Declaration</h4>    
    <code class="language-swift">func contains&lt;S : SequenceType, L : BooleanType&gt;(seq: S, predicate: @noescape (S.Generator.Element) -&gt; L) -&gt; Bool</code>
    
    
</div></div>
</div>
